def dictionairy():
    key_value = {}
    key_value[2] = 56
    key_value[1] = 2
    key_value[5] = 12
    key_value[4] = 24
    key_value[6] = 18
    key_value[3] = 323

#     print("按键（key）排序:")
#     for i in sorted(key_value):
#         print(i,key_value[i],end=' ')

    print(sorted(key_value.items(),key=lambda kv:(kv[1],kv[0])))

def main():
    dictionairy()

if __name__ == '__main__':
    main()


list = [{ "name" : "Taobao", "age" : 100},
{ "name" : "Runoob", "age" : 7 },
{ "name" : "Google", "age" : 100 },
{ "name" : "Wiki" , "age" : 200 }]

print(sorted(list,key=lambda i: i['age']))

print(sorted(list,key=lambda i: (i['age'],i['name'])))


print(sorted(list,key=lambda i: i['age'],reverse=True))


